<template>
  <div class="swiper">
    <swiper :options="swiperOption">
      <!-- slides -->
      <swiper-slide v-for="item of list" :key="item.id"><img  class="swiper-img"
                         :src="item.imgUrl"
                         alt=""></swiper-slide>

      <!-- Optional controls -->
      <div class="swiper-pagination" slot="pagination"></div>
      <!--<div class="swiper-button-prev" slot="button-prev"></div>-->
      <!--<div class="swiper-button-next" slot="button-next"></div>-->
      <!--<div class="swiper-scrollbar"   slot="scrollbar"></div>-->
    </swiper>
  </div>

</template>

<script type="es6">
export default {
  name: 'carrousel',
  props: {
    list: Array
  },
  data () {
    return {
      swiperOption: {
        // some swiper options/callbacks
        // 所有的参数同 swiper 官方 api 参数
        // ...
        pagination: {
          el: '.swiper-pagination'
        },
        loop: true
      }
      // swiperList: [{
      //   id: '01',
      //   imgUrl: 'http://img1.qunarzz.com/piao/fusion/1805/77/f63bd04dd5319602.jpg_750x200_6ba8e0ca.jpg'
      // }, {
      //   id: '02',
      //   imgUrl: 'http://img1.qunarzz.com/piao/fusion/1805/6b/c3f048f58ca46402.jpg_750x200_822e31a8.jpg'
      // }]
    }
  }
}
</script>

<style scoped lang="less">

  /*改变全局样式 less 预处理器无法正确解析 >>>。这种情况下你可以用 /deep/ 操作符取而代之 —— 这是一个 >>> 的别名，同样可以正常工作。*/
  .swiper /deep/ .swiper-pagination-bullet-active {
    background: #fff !important;
  }
  .swiper /deep/.swiper-container{
    overflow: hidden;
    height: 2.4rem;
  }
  .swiper {
    overflow: hidden;
    height: 2.4rem;

  .swiper-img {
    width: 100%;
    height: 100%;
  }

  }

</style>
